﻿using System.Data.Entity;
using Abs.Core.DAL.EntityFramework;
using Abs.Core.DAL.SetUpDatabase;

namespace Abs.Core.DAL
{
    public static class ContextFactory
    {
        public static void SetUpDatabase()
        {
            Database.SetInitializer<AbsContext>(new AbsInitializer());
            using(var absContext = new AbsContext())
                absContext.Database.Initialize(force:true);
        }//end of public static void SetUpDatabase()

        /// <summary>
        /// Get new instance of AbsContext which use Entity Framework
        /// implementation
        /// </summary>
        public static AbsContext AbsContext
        {
            get
            {
                return new AbsContext();
            }
        }//end of public static AbsContext AbsContext

        
    }//end of public static class ContextFactory
}//end of namespace ABS.DAL